<extend name="Public/base"/>

<block name="body">
    <div class="cf">
		<div class="fl">
            <a class="btn" href="{:U('Goods/edit')}">新 增</a>
            <a class="btn ajax-post" href="{:U('Goods/status?s=1')}" target-form="ids">上架</a>
           
            <button class="btn ajax-post confirm" url="{:U('Goods/del')}" target-form="ids">删 除</button>
        </div>

        <!-- 高级搜索 -->
		<div class="search-form fr cf">
			<div class="">
				<select class="" name="cate_id">
                                        <option value="0">选择栏目</option>
                                        <volist name='category' id='data'>
                                        <option value="{$data['id']}">
                                        	<if condition="$data.p_id gt 0">
                                        		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        	</if>	
                                        		{$data['category_name']}</option>
                                        </volist>                                        
                                    </select>
				<a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
			</div>
		</div>
    </div>
        
        
    <div class="data-table table-striped">
           
            <table class="">
                <thead>
                    <tr >
                       <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                        <th>商品名称</th>
                        <th>商品类型</th>
                        <th>价格(元)</th>
					  <th>折扣价(元)</th>
                        <th>添加人</th>
                        <th>状态</th>
                        <th>添加时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                <notempty name="goodsList">
                <volist name="goodsList" id="data">
                    <tr class="pointer even" title="">
                        <td><input class="ids" type="checkbox" name="id[]" value="{$data.id}" /></td>
                        <td><a href="{$data['item_url']}" target='_blank'>{$data['title']}</a></td>
                        <td>{$data['goods_type']}</td>
                        <td>{$data['price']}</td>
						<td>{$data['discount_price']}</td>
                        <td>{$data['add_uname']}</td>
                        <td>
                        	<a class="confirm ajax-get" href="<eq name='data.status' value='3'>javascript:void();<else/>{:U('Goods/status',array('id'=>$data['id'],'status'=>$data['status']))}</eq>" title="">
		                        <eq name="data.status" value="1" ><font color="green">上架</font></eq>
		                        <eq name="data.status" value="0"><font color="orange">下架</font></eq>
		                        <eq name="data.status" value="3"><font color="red">无效</font></eq>
                        	</a>
                        </td>
                        <td>{:date('Y-m-d H:i:s',$data['ctime'])}</td>
                        <td> 
                            <a target="_blank" href='http://pub.alimama.com/myunion.htm?spm=a2320.7388781.a214tr8.d006.IyDOZN#!/promo/self/items?q={:urlencode($data[item_url])}'>查看</a>
                            |
                            <a id="" href="{:U('Goods/edit',array('id'=>$data['id']))}" title="">编辑</a>
                            |
                            <a class="confirm ajax-get" href="{:U('Goods/del?id='.$data['id'])}" title="删除">删除</a>
                        </td>
                    </tr>
                </volist>
                <else/>
				<td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
                </tbody>
            </table></div>
    <div class="page">
        {$_page}
    </div>
    
    <script type="text/javascript">
    
    $(function(){
       
      //搜索功能
    	$("#search").click(function(){
    		var url = $(this).attr('url');
            var query  = $('.search-form').find('select').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
    		window.location.href = url;
    	});
    });
  
    
</script>
</block>
     

